home *** CD-ROM | disk | FTP | other *** search
Text File | 2003-07-17 | 49.4 KB | 1,742 lines |
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: 12 July 1996
- // Author: spam
- //
- // Description:
- // This file implements the connectWindow for making connections between nodes.
- //
- //////////////////////////////////////////////////////////////////////
- //
- // Procedure Name:
- // connectWinModalCmd
- //
- // Description:
- // conifugres the window to either me modal (ie, do a bunch of things,
- // then press a button to perform the actions) or interactive, where
- // connections are made/broken for each click in the input window.
- //
- // Input Arguments:
- // $topWindow - name of the top connection window for control name construction
- //
- // Return Value:
- // None.
- //
- global proc connectWinModalCmd(string $topWindow)
- {
- global string $rightWin, $leftWin;
-
- int $autoConnect = `optionVar -q "connectWindowAutoConnect"`;
- int $isModal = 0;
-
- if($autoConnect == 0) {
- $isModal = 1;
- }
-
- string $buttonParent = $topWindow + "|tl|cwForm|";
-
- string $dis = $buttonParent + "dis";
- string $con = $buttonParent + "con";
-
- button -e -enable $isModal $dis;
- button -e -enable $isModal $con;
-
- int $leftToRight = 1;
-
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
-
- if($autoConnect) {
- // we've just turned off autoconnect; set input window
- // to highlight unconnected pressed plugs.
- if($leftToRight) {
- nodeOutliner -e -pressHighlightsUnconnected false $rightWin;
- } else {
- nodeOutliner -e -pressHighlightsUnconnected false $leftWin;
- }
- } else {
- // we've just turned on autoconnect; set input window
- // to not highlight unconnected pressed plugs.
- nodeOutliner -e -pressHighlightsUnconnected true $rightWin;
- nodeOutliner -e -pressHighlightsUnconnected true $leftWin;
- }
- }
-
- global proc nodeOutlinerOutputsCmd(string $outWin, string $inWin)
- //
- // Procedure Name:
- // nodeOutlinerOutputsCmd
- //
- // Description:
- // sets the connectivity attribute of the rightWin to be the
- // last clicked item in the input win.
- //
- // Input Arguments:
- // outWin - the output winodw name
- // inWin - the input winodw name
- //
- // Return Value:
- // None.
- //
- {
- string $tempVar;
- $tempVar = `nodeOutliner -q -lastClickedNode $outWin`;
- nodeOutliner -e -c $tempVar $inWin;
- }
-
- global proc nodeOutlinerInputsCmd(string $outWin, string $inWin)
- //
- // Procedure Name:
- // nodeOutlinerInputsCmd
- //
- // Description:
- // connects the last clicked attr in the inwin
- //
- //
- // Input Arguments:
- // inWin - the input winodw name
- // outWin - the output winodw name
- //
- // Return Value:
- // None.
- //
- {
- int $autoConnect = `optionVar -q "connectWindowAutoConnect"`;
-
- if($autoConnect == 1) {
- global string $rightWin, $leftWin;
- string $outTemp, $inTemp, $cmd;
- $outTemp = `nodeOutliner -q -lastClickedNode $outWin` ;
- $inTemp = `nodeOutliner -q -lastClickedNode $inWin` ;
-
- if($outTemp != " " && $inTemp != " ") {
-
- string $tokens[];
- tokenize($outTemp, ".", $tokens);
- int $numTokens1 = `size $tokens`;
- tokenize($inTemp, ".", $tokens);
- int $numTokens2 = `size $tokens`;
-
- if($numTokens1 > 1 && $numTokens2 > 1 ) {
- string $result;
-
- string $outTempType = `nodeType $outTemp`;
- string $inTempType = `nodeType $inTemp`;
-
- // must special case this - it is still possible to get unit conversion
- // nodes to appear in the CW, and the window will not function properly
- // if the "-ignoreUnitConversion" flag is used
- //
- string $iucFlag = "-ignoreUnitConversion";
- if ( $outTempType == "unitConversion" || $inTempType == "unitConversion") {
- $iucFlag = "";
- }
-
- string $conCmd = "isConnected " + $iucFlag + " " + $outTemp + " " + $inTemp;
-
- if(`eval $conCmd` != 0) {
- $cmd = ("disconnectAttr "+$outTemp+" "+$inTemp+";\n");
- } else {
- $cmd = ("connectAttr -f "+$outTemp+" "+$inTemp+";\n");
- }
- $result = `evalEcho $cmd`;
- }
-
- // redraw the window not clicked in
- int $leftToRight = 1;
-
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
-
- if($leftToRight == 1) {
- nodeOutliner -e -redraw $leftWin;
- } else {
- nodeOutliner -e -redraw $rightWin;
- }
- }
- }
- }
-
- global proc connectWindowValues(string $windowName)
- //
- // Procedure Name:
- // connectWindowValues
- //
- // Description:
- // updates the configure frame controls to the state
- // of the node outliners.
- //
- // Input Arguments:
- // $windowName - name of the connection Window, used
- // to generate the control names.
- //
- // also uses two global variables, $rightWin and $leftWin
- // Which are the names of the input and output configured nodeOutliners
- // in the connect window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin, $leftWin;
- int $value;
-
- if(`menuItem -exists "autoConnectCWMI"`) {
- $value = `optionVar -q "connectWindowAutoConnect"`;
- menuItem -e -checkBox $value "autoConnectCWMI";
- }
-
- if(`menuItem -exists "leftSideCWInputMI"`) {
- $cmd = "nodeOutliner -q -showReadOnly "+$leftWin;
- $value = `eval $cmd`;
- if($value == 1) {
- menuItem -e -radioButton $value "leftSideCWReadOnlyMI";
- } else {
- $cmd = "nodeOutliner -q -showInputs "+$leftWin;
- $value = `eval $cmd`;
- if($value == 1) {
- menuItem -e -radioButton $value "leftSideCWInputMI";
- } else {
- $cmd = "nodeOutliner -q -showOutputs "+$leftWin;
- $value = `eval $cmd`;
- menuItem -e -radioButton $value "leftSideCWOutputMI";
- }
- }
-
- $cmd = "nodeOutliner -q -showNonKeyable "+$leftWin;
- $value = `eval $cmd`;
- menuItem -e -checkBox $value "leftSideCWNonKeyMI";
-
- $cmd = "nodeOutliner -q -showConnectedOnly "+$leftWin;
- $value = `eval $cmd`;
- menuItem -e -checkBox $value "leftSideCWConOnlyMI";
-
- $cmd = "nodeOutliner -q -showHidden "+$leftWin;
- $value = `eval $cmd`;
- menuItem -e -checkBox $value "leftSideCWHiddenMI";
-
- }
-
- if(`menuItem -exists "rightSideCWInputMI"`) {
-
- $cmd = "nodeOutliner -q -showReadOnly "+$rightWin;
- $value = `eval $cmd`;
- if($value == 1) {
- menuItem -e -radioButton $value "rightSideCWReadOnlyMI";
- } else {
- $cmd = "nodeOutliner -q -showInputs "+$rightWin;
- $value = `eval $cmd`;
- if($value == 1) {
- menuItem -e -radioButton $value "rightSideCWInputMI";
- } else {
- $cmd = "nodeOutliner -q -showOutputs "+$rightWin;
- $value = `eval $cmd`;
- menuItem -e -radioButton $value "rightSideCWOutputMI";
- }
- }
-
- $cmd = "nodeOutliner -q -showNonKeyable "+$rightWin;
- $value = `eval $cmd`;
- menuItem -e -checkBox $value "rightSideCWNonKeyMI";
-
- $cmd = "nodeOutliner -q -showConnectedOnly "+$rightWin;
- $value = `eval $cmd`;
- menuItem -e -checkBox $value "rightSideCWConOnlyMI";
-
- $cmd = "nodeOutliner -q -showHidden "+$rightWin;
- $value = `eval $cmd`;
- menuItem -e -checkBox $value "rightSideCWHiddenMI";
- }
- }
-
- global proc connectWindowMenuCmd(string $itemName)
- //
- // Procedure Name:
- // connectWindowMenuCmd
- //
- // Description:
- // Command called by every item in the connect window menu
- //
- // Input Arguments:
- // $itemName - the name of the item calling this command
- //
- // also uses two global variables, $rightWin and $leftWin
- // Which are the names of the input and output configured nodeOutliners
- // in the connect window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $leftWin, $rightWin;
- int $value, $antiValue;
-
- if($itemName == "autoConnectCWMI") {
- $value = `menuItem -q -checkBox $itemName`;
- $antiValue = !$value;
- optionVar -intValue "connectWindowAutoConnect" $value;
- connectWinModalCmd connectWindow;
- } else if ($itemName == "leftSideCWInputMI") {
- $value = `menuItem -q -radioButton $itemName`;
- $antiValue = !$value;
- nodeOutliner -e -showInputs $value -showOutputs $antiValue -showReadOnly $antiValue $leftWin;
- } else if ($itemName == "rightSideCWInputMI") {
- $value = `menuItem -q -radioButton $itemName`;
- $antiValue = !$value;
- nodeOutliner -e -showInputs $value -showOutputs $antiValue -showReadOnly $antiValue $rightWin;
- } else if ($itemName == "leftSideCWOutputMI") {
- $value = `menuItem -q -radioButton $itemName`;
- $antiValue = !$value;
- nodeOutliner -e -showOutputs $value -showInputs $antiValue -showReadOnly $antiValue $leftWin;
- } else if ($itemName == "rightSideCWOutputMI") {
- $value = `menuItem -q -radioButton $itemName`;
- $antiValue = !$value;
- nodeOutliner -e -showOutputs $value -showInputs $antiValue -showReadOnly $antiValue $rightWin;
- } else if ($itemName == "leftSideCWReadOnlyMI") {
- $value = `menuItem -q -radioButton $itemName`;
- $antiValue = !$value;
- nodeOutliner -e -showReadOnly $value -showInputs $antiValue -showOutputs $antiValue $leftWin;
- } else if ($itemName == "rightSideCWReadOnlyMI") {
- $value = `menuItem -q -radioButton $itemName`;
- $antiValue = !$value;
- nodeOutliner -e -showReadOnly $value -showInputs $antiValue -showOutputs $antiValue $rightWin;
- } else if ($itemName == "leftSideCWNonKeyMI") {
- $value = `menuItem -q -checkBox $itemName`;
- nodeOutliner -e -showNonKeyable $value $leftWin;
- optionVar -iv "connectWindowLeftSNK" $value;
- } else if ($itemName == "rightSideCWNonKeyMI") {
- $value = `menuItem -q -checkBox $itemName`;
- nodeOutliner -e -showNonKeyable $value $rightWin;
- optionVar -iv "connectWindowRightSNK" $value;
- } else if ($itemName == "leftSideCWConOnlyMI") {
- $value = `menuItem -q -checkBox $itemName`;
- nodeOutliner -e -showConnectedOnly $value $leftWin;
- optionVar -iv "connectWindowLeftCNO" $value;
- } else if ($itemName == "rightSideCWConOnlyMI") {
- $value = `menuItem -q -checkBox $itemName`;
- nodeOutliner -e -showConnectedOnly $value $rightWin;
- optionVar -iv "connectWindowRightCNO" $value;
- } else if ($itemName == "leftSideCWHiddenMI") {
- $value = `menuItem -q -checkBox $itemName`;
- nodeOutliner -e -showHidden $value $leftWin;
- optionVar -iv "connectWindowLeftSHD" $value;
- } else if ($itemName == "rightSideCWHiddenMI") {
- $value = `menuItem -q -checkBox $itemName`;
- nodeOutliner -e -showHidden $value $rightWin;
- optionVar -iv "connectWindowRightSHD" $value;
- }
- }
-
- global proc connectWindowSwitchCmd(string $controlName)
- //
- // Procedure Name:
- // connectWindowSwitchCmd
- //
- // Description:
- // script to allow connections change the connection direction
- // in the connect window.
- //
- // Input Arguments:
- // $controlName - which is the name of the button to be
- // label changed.
- //
- // also uses two global variables, $rightWin and $leftWin
- // Which are the names of the input and output configured nodeOutliners
- // in the connect window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin, $leftWin;
-
- string $cmd;
-
- int $outHidden = `nodeOutliner -q -showHidden $leftWin`;
- int $inHidden = `nodeOutliner -q -showHidden $rightWin`;
-
- // get the name of the parent of the button
- string $tokens[];
- tokenize ( $controlName,"|",$tokens );
-
- string $formParent = $tokens[0];
- int $i;
- int $numTokens = `size $tokens`;
-
- for($i = 1; $i < $numTokens - 1; $i++) {
- $formParent += ("|" + $tokens[$i]);
- }
- string $children[] = `formLayout -q -childArray $formParent`;
-
- // assume this layout was created by MEL function connectWindow,
- // and the first two children are the labels.
- // find out the state of the connection window, and
- // change the labels accordingly.
-
- int $autoConnect = 1;
-
- if(`optionVar -exists "connectWindowAutoConnect"` == 1) {
- $autoConnect = `optionVar -q "connectWindowAutoConnect"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $autoConnect;
- }
-
- int $leftToRight = 1;
-
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
-
- $phuIn = "";
- $phuOut = "";
- if($autoConnect) {
- $phuIn = " -pressHighlightsUnconnected false ";
- $phuOut = " -pressHighlightsUnconnected true ";
- }
-
- if($leftToRight != 1) {
- optionVar -iv "connectWindowLeftToRight" true;
- button -e -l "from -> to" $controlName;
- text -e -l "Inputs" $children[0];
- text -e -l "Outputs" $children[1];
-
- // configure $inputs to show inputs
- $cmd = ("nodeOutliner -e -multiSelect true -showInputs true -showOutputs false -showHidden "
- + $outHidden + $phuIn + " -noConnectivity -selectCommand \"nodeOutlinerInputsCmd "
- + $leftWin + " " + $rightWin + "; nodeOutliner -e -r " + $rightWin
- + "\" " + $rightWin);
- evalEcho $cmd;
-
- // configure $outputs to show outputs
- $cmd = ("nodeOutliner -e -multiSelect false -showInputs false -showOutputs true -showHidden " +
- $inHidden + $phuOut + " -noConnectivity -selectCommand \"nodeOutlinerOutputsCmd " + $leftWin +
- " " + $rightWin + "; nodeOutliner -e -r " + $leftWin + "\" " + $leftWin);
- evalEcho $cmd;
-
- } else {
- optionVar -iv "connectWindowLeftToRight" false;
- button -e -l "to <- from" $controlName;
- text -e -l "Outputs" $children[0];
- text -e -l "Inputs" $children[1];
-
- // configure $inputs to show outputs
- $cmd = ("nodeOutliner -e -multiSelect false -noConnectivity -showInputs false -showOutputs " +
- "true -showHidden " + $outHidden + $phuOut + " -selectCommand \"nodeOutlinerOutputsCmd " +
- $rightWin + " " + $leftWin + "; nodeOutliner -e -r "+$rightWin + "\" "
- + $rightWin);
- evalEcho $cmd;
-
- // configure $outputs to show inputs
- $cmd = ("nodeOutliner -e -multiSelect true -noConnectivity -showInputs true -showOutputs false " +
- "-showHidden " + $inHidden + $phuIn + " -selectCommand \"nodeOutlinerInputsCmd " +
- $rightWin + " " + $leftWin + "; nodeOutliner -e -r " + $leftWin + "\" " +
- $leftWin);
- evalEcho $cmd;
- }
-
- // update the frame
- string $tokens[];
- tokenize ($controlName,"|",$tokens);
-
- connectWindowValues $tokens[0];
-
- if(`popupMenu -exists leftPropagateMenu`) {
- popupMenu -e -deleteAllItems leftPropagateMenu;
- }
- }
-
- global proc connectWindowClearCmd()
- //
- // Procedure Name:
- // connectWindowClearCmd
- //
- // Description:
- // empty the contents of the window
- //
- // Input Arguments:
- // none, but uses two global variables, $rightWin and $leftWin
- // Which are the names of the input and output configured nodeOutliners
- // in the connect window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin;
- global string $leftWin;
- global string $connectWinLeftLabel;
- global string $connectWinRightLabel;
-
- string $cmd = ("nodeOutliner -q -nd \""+$rightWin+ "\"");
- string $contents[] = `eval $cmd`;
-
- int $numNodes = `size $contents`;
- int $i;
-
- $cmd = "nodeOutliner -e -noConnectivity";
- for($i = 0; $i < $numNodes; $i++) {
- $cmd += " -remove " + $contents[$i];
- }
- $cmd += (" \"" + $rightWin + "\"");
- eval $cmd;
-
- $cmd = ("nodeOutliner -q -nd "+$leftWin);
- $contents = `eval $cmd`;
- $numNodes = `size $contents`;
-
- $cmd = "nodeOutliner -e -noConnectivity";
- for($i = 0; $i < $numNodes; $i++) {
- $cmd += ("-remove " + $contents[$i] + " ");
- }
- $cmd += ("\"" + $leftWin + "\"");
- eval $cmd;
-
- if(`popupMenu -exists rightPropagateMenu`) {
- popupMenu -e -deleteAllItems rightPropagateMenu;
- }
- if(`popupMenu -exists leftPropagateMenu`) {
- popupMenu -e -deleteAllItems leftPropagateMenu;
- }
-
- text -e -l " " $connectWinLeftLabel;
- text -e -l " " $connectWinRightLabel;
- }
-
- global proc connectWindowRemoveCmd()
- //
- // Procedure Name:
- // connectWindowRemoveCmd
- //
- // Description:
- // remove the highlighted items from display in the window
- // reset the connectivity in the input window if the connectivity
- // happens to be the one deleted.
- //
- // Input Arguments:
- // none, but uses two global variables, $rightWin and $leftWin
- // Which are the names of the input and output configured nodeOutliners
- // in the connect window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin;
- global string $leftWin;
- global string $connectWinLeftLabel;
- global string $connectWinRightLabel;
-
- int $leftToRight = 1;
-
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
-
- // remove from right win
-
- string $cmd = ("nodeOutliner -q -currentSelection "+$rightWin);
- string $contents[] = `eval $cmd`;
- string $connectivity = "";
-
- int $numNodes = `size $contents`;
-
- if ( $numNodes > 0 ) {
- if(! $leftToRight) {
- $connectivity = `nodeOutliner -q -connectivity $leftWin`;
- }
-
- $cmd = "nodeOutliner -e ";
- for($node in $contents) {
- $cmd += ("-remove " + $node + " ");
- if($connectivity == $node) {
- nodeOutliner -e -noConnectivity $leftWin;
- }
- }
- $cmd += $rightWin;
- eval $cmd;
-
- // reset the label
- $contents = `nodeOutliner -q -nd $rightWin`;
- $numNodes = `size $contents`;
- if ( $numNodes > 0 ) {
- text -e -l $contents[0] $connectWinRightLabel;
- } else {
- text -e -l " " $connectWinRightLabel;
- }
- }
-
- // remove from output win
- $cmd = ("nodeOutliner -q -currentSelection "+$leftWin);
- $contents = `eval $cmd`;
-
- $numNodes = `size $contents`;
-
- if ( $numNodes > 0 ) {
- if($leftToRight) {
- $connectivity = `nodeOutliner -q -connectivity $rightWin`;
- }
-
- $cmd = "nodeOutliner -e ";
- for($node in $contents) {
- $cmd += ("-remove " + $node + " ");
- if($connectivity == $node) {
- nodeOutliner -e -noConnectivity $rightWin;
- }
- }
- $cmd += $leftWin;
- eval $cmd;
-
- // reset the label
- $contents = `nodeOutliner -q -nd $leftWin`;
- $numNodes = `size $contents`;
- if ( $numNodes > 0 ) {
- text -e -l $contents[0] $connectWinLeftLabel;
- } else {
- text -e -l " " $connectWinLeftLabel;
- }
- }
- if(`popupMenu -exists rightPropagateMenu`) {
- popupMenu -e -deleteAllItems rightPropagateMenu;
- }
- if(`popupMenu -exists leftPropagateMenu`) {
- popupMenu -e -deleteAllItems leftPropagateMenu;
- }
- }
-
- global proc connectWindowBreakCmd()
- //
- // Procedure Name:
- // connectWindowBreakCmd
- //
- // Description:
- // script for breaking the connections between highlighted
- // attributes in the node connection window.
- //
- // Input Arguments:
- // none, but uses two global variables, $rightWin and $leftWin
- // Which are the names of the input and output configured nodeOutliners
- // in the connect window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin;
- global string $leftWin;
-
- // get current selections in both windows
-
- string $cmd = ("nodeOutliner -q -currentSelection "+$rightWin);
- string $input[] = `evalEcho $cmd`;
-
- // remove from output win
-
- $cmd = ("nodeOutliner -q -currentSelection "+$leftWin);
- string $output[] = `evalEcho $cmd`;
-
- int $leftToRight = 1;
-
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
-
- int $numNodes;
-
- if($leftToRight != 1) {
- $numNodes = `size $output`;
-
- if( `size $input` == 1 && $numNodes > 0) {
- int $i;
- for($i = 0; $i < $numNodes; $i++) {
- $cmd = ("disconnectAttr " + $input[0] + " " + $output[$i]);
- evalEcho $cmd;
- }
- }
- } else {
- $numNodes = `size $input`;
-
- if( `size $output` == 1 && $numNodes > 0) {
- int $i;
- for($i = 0; $i < $numNodes; $i++) {
- $cmd = ("disconnectAttr " + $output[0] + " " + $input[$i]);
- evalEcho $cmd;
- }
- }
- }
-
- // redraw both windows
- nodeOutliner -e -redraw $leftWin;
- nodeOutliner -e -redraw $rightWin;
-
- if(`popupMenu -exists rightPropagateMenu`) {
- popupMenu -e -deleteAllItems rightPropagateMenu;
- }
- if(`popupMenu -exists leftPropagateMenu`) {
- popupMenu -e -deleteAllItems leftPropagateMenu;
- }
- }
-
- global proc connectWindowMakeCmd()
- //
- // Procedure Name:
- // connectWindowMakeCmd
- //
- // Description:
- // script for making the connections between highlighted attributes in the
- // node connection window.
- //
- // Input Arguments:
- // none, but uses two global variables, $rightWin and $leftWin
- // Which are the names of the input and output configured nodeOutliners
- // in the connect window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin;
- global string $leftWin;
-
- // get current selections in both windows
- //
- string $cmd = ("nodeOutliner -q -currentSelection "+$rightWin);
- string $input[] = `evalEcho $cmd`;
-
- // remove from output win
- //
- $cmd = ("nodeOutliner -q -currentSelection "+$leftWin);
- string $output[] = `evalEcho $cmd`;
-
- int $numNodes;
- string $result;
-
- int $leftToRight = 1;
-
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
-
- if($leftToRight) {
- $numNodes = `size $input`;
- if( `size $output` == 1 && $numNodes > 0) {
- int $i;
- for($i = 0; $i < $numNodes; $i++) {
- $cmd = ("connectAttr -f " + $output[0] + " " +$input[$i]);
- $result = `evalEcho $cmd`;
- }
- }
- } else {
- $numNodes = `size $output`;
- if( `size $input` == 1 && $numNodes > 0) {
- int $i;
- for($i = 0; $i < $numNodes; $i++) {
- $cmd = ("connectAttr -f " + $input[0] + " " +$output[$i]);
- $result = `evalEcho $cmd`;
- }
- }
- }
-
- // redraw both windows
- nodeOutliner -e -redraw $leftWin;
- nodeOutliner -e -redraw $rightWin;
-
- if(`popupMenu -exists rightPropagateMenu`) {
- popupMenu -e -deleteAllItems rightPropagateMenu;
- }
- if(`popupMenu -exists leftPropagateMenu`) {
- popupMenu -e -deleteAllItems leftPropagateMenu;
- }
- }
-
- global proc connectWindowAddToLeft(string $nodeName)
- //
- // Procedure Name:
- // connectWindowAddToLeft
- //
- // Description:
- // Add the named node to the left side of the connection window
- //
- // Input Arguments:
- // $nodeName, expected to be either a node's name or a node.attribute
- // also uses the global variable $leftWin
- // the nodeOutliner on the left side of the connect
- // window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $leftWin;
- global string $connectWinLeftLabel;
-
- string $tokens[];
- tokenize ($nodeName,".",$tokens);
-
- if(`window -exists "connectWindow"`) {
- nodeOutliner -e -addObject $tokens[0] -noConnectivity $leftWin;
- text -e -l $nodeName $connectWinLeftLabel;
- }
- if(`popupMenu -exists leftPropagateMenu`) {
- popupMenu -e -deleteAllItems leftPropagateMenu;
- }
- }
-
- global proc connectWindowSetLeftLabel(string $label)
- //
- // Procedure Name:
- // connectWindowSetLeftLabel
- //
- // Description:
- // Set the left label on the left side to the input string
- //
- // Input Arguments:
- // $label - the new label value.
- //
- // Return Value:
- // None.
- //
- {
- global string $connectWinLeftLabel;
-
- if(`window -exists "connectWindow"`) {
- text -e -l $label $connectWinLeftLabel;
- }
- }
-
- global proc connectWindowFillFromActiveList(int $side )
- //
- // Procedure Name:
- // connectWindowFillFromActiveList
- //
- // Description:
- // Load what's active into one side of the connection window
- //
- // Input Arguments:
- // $side: 0 will replace the left side, != 0 will replace the right
- //
- // Return Value:
- // None.
- //
- {
- global string $leftWin;
- global string $rightWin;
-
- if(`window -exists "connectWindow"`) {
-
- string $nodeOutlinerName;
-
- if( $side == 0 ) {
- $nodeOutlinerName = $leftWin;
- if(`popupMenu -exists leftPropagateMenu`) {
- popupMenu -e -deleteAllItems leftPropagateMenu;
- }
- } else {
- $nodeOutlinerName = $rightWin;
- if(`popupMenu -exists rightPropagateMenu`) {
- popupMenu -e -deleteAllItems rightPropagateMenu;
- }
- }
-
- string $active[];
- $active = `ls -sl`;
-
- int $numActive = `size $active`;
-
- if( $numActive > 0) {
- string $cmd = ("nodeOutliner -e -replace " + $active[0] + " " + $nodeOutlinerName);
- evalEcho $cmd;
-
- // If the outputs window is being refreshed, force a refresh
- // and re-setting of connectivity parameters of the inputs
- // window, so any rows that are dimmed will be undimmed.
- //
- int $leftToRight = 1;
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- }
-
- if ($leftToRight == 1)
- {
- // If outputs are in the left window and the left window
- // has been re-loaded, clear the connectivity of the
- // right window so it will refresh.
- //
- if ($nodeOutlinerName == $leftWin)
- {
- nodeOutliner -e -nc $rightWin;
- }
- }
- else
- {
- // If outputs are in the right window and the right window
- // has a new node in it, clear the connectivity of the left
- // window so it will refresh.
- //
- if ($nodeOutlinerName == $rightWin)
- {
- nodeOutliner -e -nc $leftWin;
- }
- }
-
- if($numActive > 1) {
- int $i;
- for($i = 1; $i < $numActive; $i++) {
- $cmd = ("nodeOutliner -e -addObject " + $active[$i] + " " + $nodeOutlinerName);
- evalEcho $cmd;
- }
- }
- }
- }
- }
-
- global proc connectWindowAddToRight(string $nodeName)
- //
- // Procedure Name:
- // connectWindowAddToRight
- //
- // Description:
- // Add the named node to the right side of the connection window
- //
- // Input Arguments:
- // $nodeName, expected to be either a node's name or a node.attribute
- // also uses the global variable $leftWin
- // the nodeOutliner on the left side of the connect
- // window script elsewhere in this file.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin;
- global string $connectWinRightLabel;
-
- string $tokens[];
- tokenize ($nodeName,".",$tokens);
-
- if(`window -exists "connectWindow"`) {
- nodeOutliner -e -addObject $tokens[0] -nc $rightWin;
- text -e -l $nodeName $connectWinRightLabel;
- }
- if(`popupMenu -exists rightPropagateMenu`) {
- popupMenu -e -deleteAllItems rightPropagateMenu;
- }
- }
-
- global proc connectWindowSetRightLabel(string $label)
- //
- // Procedure Name:
- // connectWindowSetRightLabel
- //
- // Description:
- // Set the right label on the right side to the input string
- //
- // Input Arguments:
- // $label - the new label value.
- //
- // Return Value:
- // None.
- //
- {
- global string $connectWinRightLabel;
-
- if(`window -exists "connectWindow"`) {
- text -e -l $label $connectWinRightLabel;
- }
- }
-
- //
- // Procedure Name:
- // CWpropagateMenuCB
- //
- // Description:
- // "pages over" the connect window. the contents of one side move
- // to the opposite window, and a given node is loaded to the empty side.
- //
- // Input Arguments:
- // $side - "-left" to page left, "-right" to page right.
- // $nodes - a string in the form "node1 node2 node3 ... nodeX"
- // representing the nodes to load into the outliner opposite $side.
- // $menu1, $menu2 - the names of the two menus so they can be cleared.
- //
- // Return Value:
- // None.
- //
- global proc CWpropagateMenuCB(string $side, string $nodes, string $menu1, string $menu2)
- {
- global string $leftWin, $rightWin;
- string $clearWin, $shuffleWin;
-
- string $contents[];
- int $leftToRight = 1;
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
- if ($side == "-left") {
- $clearWin = $leftWin;
- $shuffleWin = $rightWin;
- } else if ($side == "-right") {
- $clearWin = $rightWin;
- $shuffleWin = $leftWin;
- }
-
- $contents = `nodeOutliner -q -nodesDisplayed $clearWin`;
-
- nodeOutliner -e -removeAll $leftWin;
- nodeOutliner -e -removeAll $rightWin;
-
- string $nodeArray[];
- tokenize ($nodes," ",$nodeArray);
- for($node in $nodeArray) {
- nodeOutliner -e -addObject $node -nc $clearWin;
- }
- for($thing in $contents) {
- nodeOutliner -e -addObject $thing -nc $shuffleWin;
- }
-
- popupMenu -e -deleteAllItems $menu1;
- popupMenu -e -deleteAllItems $menu2;
- }
-
- //
- // Procedure Name:
- // CWpropagateMenu
- //
- // Description:
- // Fills a popup menu with the currently connected attr names.
- // Depending on the input strings and the connect window configuration.
- //
- // Input Arguments:
- // $side - "-left" for the left button, "-right" for the right button.
- // $menu - the name of the menu holding the items
- // $otherMenu - the name of the opposite menu
- //
- // Return Value:
- // None.
- //
- global proc CWpropagateMenu(string $side, string $menu, string $otherMenu)
- {
- global string $rightWin, $leftWin;
- setParent -m $menu;
-
- popupMenu -e -deleteAllItems $menu;
-
- int $leftToRight = 1;
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
-
- string $nodes[];
- if ($side == "-left") {
- $nodes = `nodeOutliner -q -nodesDisplayed $leftWin`;
- } else {
- $nodes = `nodeOutliner -q -nodesDisplayed $rightWin`;
- }
-
- int $i,$numcons,$showconn = true,$count = 0;
- string $connections[];
- string $nodeArray[];
- string $types[];
- string $class[];
- string $nearplug,$farplug;
-
- if (($side == "-left" && $leftToRight == 1) ||
- ($side == "-right" && $leftToRight == 0)
- ) {
-
- for ($node in $nodes) {
- if($count > 0) {
- menuItem -divider true;
- }
-
- catch ($connections =
- `listConnections -s true -d false -c true -p true $node`);
- $numcons = size($connections);
-
- for ($i = 0; $i < $numcons; $i+=2) {
- $nearplug = $connections[$i];
- $farplug = $connections[$i+1];
- tokenize($farplug, ".", $nodeArray);
- menuItem -l ($farplug + "->" + $nearplug)
- -c ("CWpropagateMenuCB "+$side + " " + $farplug +
- " " + $menu + " " + $otherMenu);
- }
- $count++;
- clear $connections;
- clear $nodeArray;
- }
- } else {
- for ($node in $nodes) {
- if($count > 0) {
- menuItem -divider true;
- }
-
- catch ($connections =
- `listConnections -s false -d true -p true -c true $node`);
- $numcons = size($connections);
-
- for ($i = 0; $i < $numcons; $i+=2) {
- $nearplug = $connections[$i];
- $farplug = $connections[$i+1];
- tokenize($farplug, ".", $nodeArray);
-
- if($nearplug == ($node + ".message")) {
- $types = `ls -showType $nodeArray[0]`;
- if(size($types) > 0) {
- $class = `getClassification $types[1]`;
- if(! ($class[0] != "" || $types[1] == "renderGlobals" ||
- $types[1] == "camera" || $types[1] == "imagePlane")) {
- $showconn = false;
- }
- clear $class;
- }
- clear $types;
- }
-
- if($showconn) {
- menuItem -l ($nearplug + "->" + $farplug) -c
- ("CWpropagateMenuCB "+$side + " " + $nodeArray[0]
- + " " + $menu + " " + $otherMenu);
- }
- $showconn = true;
- }
- $count++;
- clear $connections;
- clear $nodeArray;
- }
- }
- }
-
- //
- // Procedure Name:
- // CWpopupMenuCB
- //
- // Description:
- // Callback for the right mouse button popup menu on the nodeOutliner.
- // Adds the last selected menu label to the opposite window.
- //
- // Input Arguments:
- // $nodeOutliner - the node outliner calling this command.
- //
- // Return Value:
- // None.
- //
- global proc CWpopupMenuCB(string $nodeOutliner)
- {
- global string $leftWin, $rightWin;
- string $cmd = "nodeOutliner -q -lastMenuChoice " + $nodeOutliner;
- string $label = `eval $cmd`;
-
- if($label != "Next Available") {
- if($nodeOutliner == $leftWin) {
- connectWindowAddToRight $label;
- } else {
- connectWindowAddToLeft $label;
- }
- }
- }
-
- //
- // Procedure Name:
- // CWpropagateButtonCB
- //
- // Description:
- // "pages over" the connect window. the contents of one side move
- // to the opposite window, and a given node is loaded to the empty side.
- // Will use the first option, if any, present in the menu
- //
- // Input Arguments:
- // $type - "-left" to page left, "-right" to page right.
- // $menu - the name of the menu of the button
- // $otherMenu - the name of the menu of the other button
- //
- // Return Value:
- // None.
- //
- global proc CWpropagateButtonCB(string $type, string $menu, string $otherMenu)
- {
- int $numItems = `popupMenu -query -numberOfItems $menu`;
- if($numItems == 0) {
- CWpropagateMenu $type $menu $otherMenu;
- $numItems = `popupMenu -query -numberOfItems $menu`;
- }
-
- string $items[] = `popupMenu -query -itemArray $menu`;
- $numItems = `size $items`;
- if($numItems > 0) {
- string $command = `menuItem -query -command $items[0]`;
- eval $command;
- }
-
- popupMenu -e -deleteAllItems $menu;
- popupMenu -e -deleteAllItems $otherMenu;
- }
-
- global proc buildCWConfigureMenu (string $menu, string $outLinerName, string $idString)
- //
- // Procedure Name:
- // buildCWConfigureMenu
- //
- // Description:
- // Creates the menus for configuring half of the connect window
- //
- // Input Arguments:
- // string $menu - the name of the menu that the items will belong to.
- // string $outLinerName - the name of the nodeOutliner to edit.
- // string $idString - A unique key string to construct the optionVar default
- // string for the filter menu options. values : "Left" or "Right"
- //
- // Return Value:
- // None.
- //
- {
- string $itemName;
- // assume that the menu parent is properly set.
- //
- $itemName = $outLinerName + "OutputMI";
- if(!`menuItem -exists $itemName`) {
-
- setParent -menu $menu;
-
- radioMenuItemCollection ($menu + "Filters");
-
- menuItem -l "Show Readable" -p $menu -radioButton false
- -command ("connectWindowMenuCmd " + $itemName)
- $itemName;
-
- $itemName = $outLinerName + "ReadOnlyMI";
- menuItem -l "Show Outputs Only" -p $menu -radioButton false
- -command ("connectWindowMenuCmd " + $itemName)
- $itemName;
-
- $itemName = $outLinerName + "InputMI";
- menuItem -l "Show Inputs Only" -p $menu -radioButton false
- -command ("connectWindowMenuCmd " + $itemName)
- $itemName;
-
- menuItem -p $menu -divider true;
-
- // find the default value, if any for the non-keyable filter
- //
- int $menuSetVal = true;
-
- if(`optionVar -exists ("connectWindow" + $idString + "SNK")` == 1) {
- $menuSetVal = `optionVar -q ("connectWindow" + $idString + "SNK")`;
- } else {
- optionVar -iv ("connectWindow" + $idString + "SNK") $menuSetVal;
- }
-
- $itemName = $outLinerName + "NonKeyMI";
- menuItem -l "Show Non-Keyable" -p $menu -checkBox $menuSetVal
- -command ("connectWindowMenuCmd " + $itemName)
- $itemName;
-
- $menuSetVal = false;
-
- if(`optionVar -exists ("connectWindow" + $idString + "CNO")` == 1) {
- $menuSetVal = `optionVar -q ("connectWindow" + $idString + "CNO")`;
- } else {
- optionVar -iv ("connectWindow" + $idString + "CNO") $menuSetVal;
- }
-
- $itemName = $outLinerName + "ConOnlyMI";
- menuItem -l "Show Connected Only" -p $menu -checkBox $menuSetVal
- -command ("connectWindowMenuCmd " + $itemName)
- $itemName;
-
- $menuSetVal = false;
-
- if(`optionVar -exists ("connectWindow" + $idString + "SHD")` == 1) {
- $menuSetVal = `optionVar -q ("connectWindow" + $idString + "SHD")`;
- } else {
- optionVar -iv ("connectWindow" + $idString + "SHD") $menuSetVal;
- }
-
- $itemName = $outLinerName + "HiddenMI";
- menuItem -l "Show Hidden" -p $menu -checkBox $menuSetVal
- -command ("connectWindowMenuCmd " + $itemName)
- $itemName;
-
- connectWindowValues "connectWindow";
- }
- }
-
- global proc buildConnectContextHelpItems(string $nameRoot, string $menuParent)
- //
- // Description:
- // Build context sensitive menu items
- //
- // Input Arguments:
- // $nameRoot - name to use as the root of all item names
- // $menuParent - the name of the parent of this menu
- //
- // Return Value:
- // None
- //
- {
- menuItem -label "Help on Connection Editor..."
- -enableCommandRepeat false
- -command "showHelp ConnectionEditor";
- }
-
- proc buildConnectWindowMenu ()
- //
- // Procedure Name:
- // buildConnectWindowMenu
- //
- // Description:
- // Creates the menus for the connection window
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin, $leftWin;
- string $itemName;
- string $tokens[];
- int $numTokens;
- string $noName = "nodeOutlinerName";
-
- // assume that the menu parent is properly set.
- menu -l "Options"
- -tearOff true
- -postMenuCommandOnce true
- -familyImage "menuIconOptions.xpm";
- menuItem -l "Auto-connect" -checkBox 1
- -command ("connectWindowMenuCmd autoConnectCWMI")
- "autoConnectCWMI";
- setParent -menu ..;
-
- tokenize ($leftWin, "|", $tokens);
- $numTokens = `size $tokens`;
- if($numTokens > 0) {
- $numTokens--;
- $noName = $tokens[$numTokens];
- }
- menu -l "Left Display"
- -tearOff true
- -postMenuCommandOnce true
- -postMenuCommand ("buildCWConfigureMenu leftSideCWM " + $noName + " Left")
- -familyImage "menuIconLeftSideFilters.xpm"
- leftSideCWM;
- setParent -menu ..;
-
- tokenize ($rightWin, "|", $tokens);
- $numTokens = `size $tokens`;
- if($numTokens > 0) {
- $numTokens--;
- $noName = $tokens[$numTokens];
- }
- menu -l "Right Display"
- -tearOff true
- -postMenuCommandOnce true
- -postMenuCommand ("buildCWConfigureMenu rightSideCWM " + $noName + " Right")
- -familyImage "menuIconRightSideFilters.xpm"
- rightSideCWM;
- setParent -menu ..;
-
- // Adds support for the Context Sensitive Help Menu.
- //
- addContextHelpProc "connectWindow" "buildConnectContextHelpItems";
-
- doHelpMenu "connectWindow" "connectWindow";
-
- connectWindowValues "connectWindow";
- }
-
- global proc connectWindow ()
- //
- // Procedure Name:
- // connectWindow
- //
- // Description:
- // Creates a window with some buttons and two node outliners,
- // Connected and separately configured
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- {
- global string $rightWin;
- global string $leftWin;
-
- if(`window -exists "connectWindow"`) {
- connectWindowClearCmd;
- showWindow connectWindow;
- } else {
- window -rtf 0 -h 620 -w 520
- -title "Connection Editor"
- -iconName "Connection"
- connectWindow;
-
- string $aTab = `menuBarLayout tl`;
-
- string $aForm = `formLayout -p $aTab cwForm`;
-
- int $autoConnect = true;
- int $modal = false;
-
- if(`optionVar -exists "connectWindowAutoConnect"` == 1) {
- $autoConnect = `optionVar -q "connectWindowAutoConnect"`;
- } else {
- optionVar -iv "connectWindowAutoConnect" $autoConnect;
- }
-
- if($autoConnect == 0) {
- $modal = true;
- }
-
- string $leftActiveBtn = `button -l "Reload Left" -p $aForm
- -c "connectWindowFillFromActiveList 0"
- -ann "Replace Left Side contents with current Selection"
- fillLeft`;
- string $rightActiveBtn = `button -l "Reload Right" -p $aForm
- -ann "Replace Right Side contents with current Selection"
- -c "connectWindowFillFromActiveList 1"
- fillRight`;
-
- string $labelForm = `formLayout labelForm`;
- string $inputText = `text -p $labelForm -l "Inputs"
- -al "center" inputText`;
- string $outputText = `text -p $labelForm -l "Outputs"
- -al "center" outputText`;
-
- string $switchBut = `button -p $labelForm -l "from -> to"
- -ann "Change to connecting in the opposite direction"
- switchBut`;
- button -e -c ("connectWindowSwitchCmd "+ $switchBut) $switchBut;
- setParent ..;
-
- formLayout -e
- -af inputText "top" 1
- -af inputText "bottom" 1
- -ap inputText "right" -50 75
-
- -af switchBut "top" 1
- -af switchBut "bottom" 1
- -ap switchBut "right" 0 65
- -ap switchBut "left" 0 35
-
- -af outputText "top" 1
- -af outputText "bottom" 1
- -ap outputText "left" -50 25
-
- $labelForm;
-
- string $connectPane = `paneLayout -configuration "vertical2"
- -separatorThickness 5 -height 300 -paneSize 1 50 100
- -paneSize 1 50 100
- connectWindowPane`;
-
- // get some value defaults for the left side nodeOutliner.
- //
- int $defaultSNK = true;
- int $defaultCNO = false;
- int $defaultSHD = false;
-
- if(`optionVar -exists ("connectWindowLeftSNK")` == 1) {
- $defaultSNK = `optionVar -q ("connectWindowLeftSNK")`;
- } else {
- optionVar -iv ("connectWindowLeftSNK") $defaultSNK;
- }
-
- if(`optionVar -exists ("connectWindowLeftCNO")` == 1) {
- $defaultCNO = `optionVar -q ("connectWindowLeftCNO")`;
- } else {
- optionVar -iv ("connectWindowLeftCNO") $defaultCNO;
- }
-
- if(`optionVar -exists ("connectWindowLeftSHD")` == 1) {
- $defaultSHD = `optionVar -q ("connectWindowLeftSHD")`;
- } else {
- optionVar -iv ("connectWindowLeftSHD") $defaultSHD;
- }
-
-
- $leftWin = `nodeOutliner -showOutputs true //configured for inputs
- -addCommand "connectWindowSetLeftLabel %node"
- -showNonConnectable false // like it says
- -showConnectedOnly $defaultCNO // like it says
- -showNonKeyable $defaultSNK // like it says
- -showHidden $defaultSHD // like it says
- -ms 0 //multiple select disallowed
- leftSideCW`;
-
- nodeOutliner -e
- -menuCommand ("CWpopupMenuCB " + $leftWin)
- $leftWin;
-
- // get some value defaults for the left side nodeOutliner.
- //
- $defaultSNK = true;
- $defaultCNO = false;
- $defaultSHD = false;
-
- if(`optionVar -exists ("connectWindowRightSNK")` == 1) {
- $defaultSNK = `optionVar -q ("connectWindowRightSNK")`;
- } else {
- optionVar -iv ("connectWindowRightSNK") $defaultSNK;
- }
-
- if(`optionVar -exists ("connectWindowRightCNO")` == 1) {
- $defaultCNO = `optionVar -q ("connectWindowRightCNO")`;
- } else {
- optionVar -iv ("connectWindowRightCNO") $defaultCNO;
- }
-
- if(`optionVar -exists ("connectWindowRightSHD")` == 1) {
- $defaultSHD = `optionVar -q ("connectWindowRightSHD")`;
- } else {
- optionVar -iv ("connectWindowRightSHD") $defaultSHD;
- }
-
- $rightWin = `nodeOutliner -showInputs true //configured for inputs
- -addCommand "connectWindowSetRightLabel %node"
- -showNonConnectable false // like it says
- -showConnectedOnly $defaultCNO // like it says
- -showNonKeyable $defaultSNK // like it says
- -showHidden $defaultSHD // like it says
- -ms true //multiple select allowed
- rightSideCW`;
-
- nodeOutliner -e
- -menuCommand ("CWpopupMenuCB " + $rightWin)
- $rightWin;
-
- int $leftToRight = 1;
- string $leftLabel, $rightLabel;
-
- if(`optionVar -exists "connectWindowLeftToRight"` == 1) {
- $leftToRight = `optionVar -q "connectWindowLeftToRight"`;
- } else {
- optionVar -iv "connectWindowLeftToRight" $leftToRight;
- }
-
- if($leftToRight == 1) {
- // just need to set commands
- button -e -l "from -> to" $switchBut;
- nodeOutliner -e
- -selectCommand ("nodeOutlinerOutputsCmd " + $leftWin + " " + $rightWin )
- $leftWin;
-
- nodeOutliner -e -pressHighlightsUnconnected false -selectCommand
- ("nodeOutlinerInputsCmd " + $leftWin + " " + $rightWin +
- "; nodeOutliner -e -r " + $rightWin)
- $rightWin;
-
- $leftLabel = "Outputs";
- $rightLabel = "Inputs";
- } else {
- // need to reconfigure the listers as well as set the commands
- text -e -label "Outputs" $inputText;
- text -e -label "Inputs" $outputText;
- button -e -l "to <- from" $switchBut;
-
- nodeOutliner -e -showInputs false -showOutputs true
- -selectCommand ("nodeOutlinerOutputsCmd " + $rightWin + " " + $leftWin)
- $rightWin;
- nodeOutliner -e -pressHighlightsUnconnected false -showInputs true
- -showOutputs false -selectCommand
- ("nodeOutlinerInputsCmd " + $rightWin + " " + $leftWin +
- "; nodeOutliner -e -r " + $leftWin )
- $leftWin;
-
- $leftLabel = "Inputs";
- $rightLabel = "Outputs";
- }
-
- setParent ..;
-
- string $labelForm2 = `formLayout labelForm2`;
- global string $connectWinRightLabel;
- $connectWinRightLabel
- = `text -l $rightLabel -p $labelForm2 -al "center" connectWinRightLabel`;
-
- global string $connectWinLeftLabel;
- $connectWinLeftLabel
- = `text -l $leftLabel -p $labelForm2 -al "center" connectWinLeftLabel`;
-
- // page left/right buttons
- string $buttonName = `button -l "<" -p $labelForm2
- -ann "Move Right Side into Left and load a Right connection into Right"
- pageLeft`;
- string $buttonName2 = `button -l ">" -p $labelForm2
- -ann "Move Left Side into Right and load a Left connection into Left"
- pageRight`;
- // menus for the button
- string $menuName = `popupMenu -parent pageLeft leftPropagateMenu`;
- string $menuName2 = `popupMenu -parent pageRight rightPropagateMenu`;
-
- popupMenu -e -postMenuCommand
- ("CWpropagateMenu -left " + $menuName + " " + $menuName2 )
- $menuName;
- button -e -c
- ("CWpropagateButtonCB -left " + $menuName + " " + $menuName2 )
- $buttonName;
- popupMenu -e -postMenuCommand
- ("CWpropagateMenu -right " + $menuName2 + " " + $menuName )
- $menuName2;
- button -e -c
- ("CWpropagateButtonCB -right " + $menuName2 + " " + $menuName )
- $buttonName2;
-
- separator -style "in" buttonSep;
-
- setParent ..;
-
- formLayout -e
-
- -af buttonSep "left" 0
- -af buttonSep "right" 0
- -af buttonSep "bottom" 5
-
- -af connectWinLeftLabel "top" 1
- -af connectWinLeftLabel "bottom" 8
- -ap connectWinLeftLabel "left" -50 25
-
- -an pageRight "top"
- -af pageRight "bottom" 8
- -ap pageRight "left" 0 50
- -ap pageRight "right" 0 54
-
- -an pageLeft "top"
- -af pageLeft "bottom" 8
- -ap pageLeft "left" 0 45
- -ap pageLeft "right" 0 49
-
- -af connectWinRightLabel "top" 1
- -af connectWinRightLabel "bottom" 8
- -ap connectWinRightLabel "right" -50 75
-
- $labelForm2;
-
- // and four more buttons at the bottom
- button -l "Clear All" -p $aForm
- -ann "Remove everything from Connection Editor"
- -c "connectWindowClearCmd" clear;
- button -l "Remove" -p $aForm
- -ann "Remove highlighted objects (if attributes highlighted, removes their object)"
- -c "connectWindowRemoveCmd" nuke;
- button -l "Break" -p $aForm -enable $modal
- -ann "Break highlighed connections"
- -c "connectWindowBreakCmd" dis;
- button -l "Make" -p $aForm -enable $modal
- -ann "Connect highlighed attributes"
- -c "connectWindowMakeCmd" con;
- button -l "Close" -p $aForm
- -ann "Close Connection Editor"
- -c "deleteUI connectWindow" closeBtn;
-
- setParent ..;
- setParent ..;
-
- // set the attachments
- int $active = 0;
-
- if(`optionVar -exists "connectWindowActive"` == 1) {
- $active = `optionVar -q "connectWindowActive"`;
- } else {
- optionVar -iv "connectWindowActive" $active;
- }
-
- formLayout -e
- -af fillLeft "top" 1
- -ap fillLeft "right" 0 49
- -af fillLeft "left" 1
-
- -af fillRight "top" 1
- -ap fillRight "left" 0 49
- -af fillRight "right" 1
-
- -ac labelForm "top" 1 fillLeft
- -af labelForm "left" 1
- -af labelForm "right" 1
-
- -ac connectWindowPane "top" 1 labelForm
- -af connectWindowPane "left" 1
- -af connectWindowPane "right" 1
- -ac connectWindowPane "bottom" 0 labelForm2
-
- -an labelForm2 "top"
- -af labelForm2 "left" 1
- -af labelForm2 "right" 1
- -ac labelForm2 "bottom" 0 clear
-
- -an clear "top"
- -af clear "left" 5
- -ap clear "right" 3 20
- -af clear "bottom" 5
-
- -an nuke "top"
- -ap nuke "left" 2 20
- -ap nuke "right" 3 40
- -af nuke "bottom" 5
-
- -an dis "top"
- -ap dis "left" 3 40
- -ap dis "right" 2 60
- -af dis "bottom" 5
-
- -an con "top"
- -ap con "left" 2 60
- -ap con "right" 3 80
- -af con "bottom" 5
-
- -an closeBtn "top"
- -ap closeBtn "left" 2 80
- -af closeBtn "right" 5
- -af closeBtn "bottom" 5
- $aForm;
-
- buildConnectWindowMenu;
-
- showWindow connectWindow;
-
- // restore the parent window so next controls made
- // don't get added to the connect Window
- //
- setParent ..;
- }
- }
-